import { Component, Vue } from "vue-property-decorator";

class MenuItem {
  disabled: boolean;
  key: number;
  title: string;
  routerName: string;
}

enum MenuKey {
  HOME_PAGES = 1
}

@Component({})
export class GlobalMenu extends Vue {
  private menuItems: MenuItem[] = null;

  created() {
    this.menuItems = [
      {
        disabled: false,
        key: MenuKey.HOME_PAGES,
        title: `${this.$t("homePage")}`,
        routerName: "home"
      }
    ];
  }

  onMenuClick(menuItem: MenuItem) {
    // Don't redirect if selected current page
    if (this.$route.name === menuItem.routerName) {
      return;
    }

    this.$router.push({
      name: menuItem.routerName
    });
  }
}

export default GlobalMenu;
